package com.atguigu.gmall.user.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.model.user.UserAddress;
import com.atguigu.gmall.user.service.api.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: 封捷
 * @create-date: 2022/9/7 11:18
 */
@RestController
@RequestMapping("/api/user")
public class UserApiController {

    @Autowired
    private UserService userService;

    @GetMapping("/inner/get/user/address/list/{userId}")
    public Result<List<UserAddress>> getUserAddressList(
            @PathVariable("userId") Long userId) {

        List<UserAddress> userAddressList = userService.getUserAddressList(userId);

        return Result.ok(userAddressList);
    }

}
